/**
 * 接口定义
 */

const API = require('./base')



/**
 * 获取手机验证码
 * @param  {object} args 参数
 * @return {promise}
 */
const getVerifyCode = function(data) {
	return API.post('/mp/l/v1/getVerifyCode', data, { token: false });
}

/**
 * 我的订单
 * @param  {object} args 参数
 * @return {promise}
 */
const getOrderList = function(curpage, curlimit, data) {
	var page = 1;
	if (curpage) {
		page = curpage;
	}
	var limit = 10;
	if (curlimit) {
		limit = curlimit;
	}
	return API.post('/mp/o/v1/taxiOrderList?page='+page+"&limit="+limit, data, { token: false });
}

/**
 * 创建订单/立即打车接口
 * @param  {object} args 参数
 * @return {promise}
 */
const createTaxiOrder = function(data) {
	return API.post('/mp/o/v1/createTaxiOrder', data, { token: false });
}

/**
 * 司机接单接口
 * @param  {object} args 参数
 * @return {promise}
 */
const receivingTaxiOrder = function(data) {
	return API.post('/mp/o/v1/receivingTaxiOrder', data, { token: false });
}

/**
 * 取消订单接口
 * @param  {object} args 参数
 * @return {promise}
 */
const cancelTaxiOrder = function(data) {
	return API.post('/mp/o/v1/cancelTaxiOrder', data, { token: false });
}

/**
 * 获取用户个人信息
 * @param  {object} args 参数
 * @return {promise}
 */
const getLoginUser = function(data) {
	return API.post('/mp/l/v1/getLoginUser', data, { token: false });
}

/**
 * 解密用户个人信息
 * @param  {object} args 参数
 * @return {promise}
 */
const getProfile = function() {
	return API.getUserInfo();
}

/**
 * 注销用户登录
 * @param  {object} args 参数
 * @return {promise}
 */
const Loginout = function() {
	return API.logout();
}

API.getProfile					    = getProfile
API.getLoginUser					    = getLoginUser
API.Loginout					      = Loginout
API.getVerifyCode           = getVerifyCode
// 订单
API.createTaxiOrder					= createTaxiOrder
API.cancelTaxiOrder					= cancelTaxiOrder
API.receivingTaxiOrder			= receivingTaxiOrder
API.getOrderList						= getOrderList
module.exports = API